package com.leyou.demo.controller;

import com.leyou.demo.UserService.userService;
import com.leyou.demo.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class HelloController {
    @Autowired
    private userService userService;
    @GetMapping("hello/{id}")
    public User findUser(@PathVariable("id")Long id){
       User user=userService.findUser(id);
       return user;
    }
    @GetMapping("hello1")
    public List<User> findUserAll(){
        List<User> list= userService.findUserAll();
        return list;
    }
}
